package com.koron.css2.projectCenter.impl;

import com.koron.css2.baseConfig.bean.UseMatrTemplateListBean;
import com.koron.css2.common.dto.AttachmentDto;
import com.koron.css2.common.service.AbstractExportExcel;
import com.koron.css2.projectCenter.dto.PjUseMatrExportDto;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.CommonUtils;
import com.koron.css2.serviceManage.utils.JsonUtils;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

public class PjUseMatrExport extends AbstractExportExcel {

	@Override
	public AttachmentDto getAttachment(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		// TODO Auto-generated method stub
		PjUseMatrExportDto dto  = JsonUtils.objectToPojo(req.getData(), PjUseMatrExportDto.class);
		List<UseMatrTemplateListBean> list = dto.getList();
		// 返回结果 FnInvoiceExport
		AttachmentDto attachment = new AttachmentDto();
		attachment.setBtlTemplate("PjUseMatrExport.btl");
		attachment.setFileTemplate("PjUseMatrExport.xlsx");
		attachment.setData(list);
		attachment.setFileType("excel");
		attachment.setFilename("施工材料模板" + CommonUtils.getCurrentDate());
		return attachment;
	}
}
